from book import Book
from pathlib import Path
from bs4 import BeautifulSoup

output_path = Path(r'./test_resource/')
output = []

book = Book(output_path/'景岳全书.epub')

resource0 = book.spine_order_to_resource[57]
soup0 = book.resource_to_bs[resource0]

subtexts = []
for tag in soup0.find('body').children:
    if tag.name == 'h4':
        output.append(''.join(subtexts))
        subtexts = [str(tag)]
    elif tag.string == '\n':
        continue
    else:
        subtexts.append(str(tag))
output.append(''.join(subtexts))


output